<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>业务详细</title>

<!-- <script src="1003/1003.js"></script> -->
<script type="text/javascript">
var coordinateID = 'coordinate';
$(function(){
	$('.changeTime').hide();
	$('.changeShip').hide();
	
	$('#changetypecode').on('DOMNodeInserted',function(){
        var changetypecode = $(this).text();
		if(changetypecode == '01'){
			$('.changeTime').show();
			$('.changeShip').hide();
		}
		else if(changetypecode == '02'){
			$('.changeTime').hide();
			$('.changeShip').show();
		}
		else{
			$('.changeTime').hide();
			$('.changeShip').hide();
		}
    })	
    

	bindCoordinateForm(applyid);
	bindShipForm(applyid);
})

function bindCoordinateForm(applyid){
	
	$.ajax({ 
		url: basePath() + 'business/getcoordinateinfo.do',
		data: {"applyid": applyid},
		dataType: "json",
        contentType: "application/json",
		success: function(data){
	    	if(data.result == 1){
	    		for(var i=0; i< data.datas.length; i++){
	    			bindCoordinateInfoList(data.datas[i]);
	    		}
	    	}
      	}
	});
}


function bindCoordinateInfoList(data){
	var serialnumber = data.serialnumber;
	var latarea = data.latarea;
	var latdegree = data.latdegree;
	var latmin = data.latmin;
	var latsecond = data.latsecond;
	var lonarea = data.lonarea;
	var londegree = data.londegree;
	var lonmin = data.lonmin;
	var lonsecond = data.lonsecond;
	
	var htmlStr = ''+		
				'  <tbody class="coordinateForm">'+
				'  <tr>'+
				'    <td rowspan="2" style="vertical-align: middle;">'+
				'		'+ serialnumber +''+
				'	 </td>'+
				'    <td>   '+
				'	      <div class="form-group">'+
				'		    <label class="col-sm-4 control-label">经度</label>'+
				'		    <div class="col-sm-8">'+
				'				'+ latarea +''+
				'		    </div>'+
				'		  </div> '+
				'    </td>'+
				'    <td>'+ latdegree +'</td>'+
				'    <td>'+ latmin +'</td>'+
				'    <td>'+ latsecond +'</td>'+
				'  </tr>'+
				'  <tr>'+
				'    <td>'+
				'	      <div class="form-group">'+
				'		    <label class="col-sm-4 control-label">纬度</label>'+
				'		    <div class="col-sm-8">'+
				'				'+ lonarea +''+
				'		    </div>'+
				'		  </div> '+
				'	  </td>'+
				'    <td>'+ londegree +'</td>'+
				'    <td>'+ lonmin +'</td>'+
				'    <td>'+ lonsecond +'</td>'+
				'  </tr>'+
				'  </tbody>';
	
	$('#' + coordinateID).append(htmlStr);
}

function bindShipForm(applyid){
	
	$.ajax({ 
		url: basePath() + 'business/getshipinfo.do',
		data: {"applyid": applyid},
		dataType: "json",
        contentType: "application/json",
		success: function(data){
			if(data.result == 1){
	    		var shipidnums = [];
	    		for(var i=0; i< data.datas.length; i++){
	    			bindShipInfoList(data.datas[i]);
		    		shipidnums.push(data.datas[i].shipidnumber);
		    		
	    		}
	    		//绑定校验数据
//	    		bindVerifyForm(applyid,shipidnums);
	    	}
      	}
	});
}


function bindShipInfoList(data){
	var shipidnumber = data.shipidnumber;
	var shipname = data.shipname;
	
	var htmlStr = ''+		
				'<tr>'+
				'	<td>'+ data.shipidnumber +'</td>'+
				'	<td>'+ data.shipname +'</td>'+
				'</tr>';
	
	$('#TableShip').append(htmlStr);
}

</script>
</head>
<body style="background-color: white;">
	<!-- 业务信息 -->
	<table class="table table-bordered">
	<tbody>
		<tr>
			<td class="tdTitle ">
				 原申请单编号：
			</td>
			<td>
				<span id="oldapplyno"></span>
			</td>
			<td class="tdTitle ">
				  变更类型：
			</td>
			<td colspan="3">
				<span id="changetype"></span>
				<span id="changetypecode" style="display: none"></span>
			</td>
		</tr>
	    <tr class="changeTime">
			<td class="tdTitle">
				申请延期期限：
			</td>
			<td colspan="5">
				<span id="delaydate"></span>
			</td>
		</tr> 
		<tr class="changeTime">
			<td class="tdTitle">
				计划开工日期：
			</td>
			<td class="tdContent">
				<span id="workbegintime"></span>
			</td>
			<td class="tdTitle">
				预计完工日期：
			</td>
			<td class="tdContent">
				<span id="workendtime"></span>
			</td>
			<td class="tdTitle">
				预计完工天数：
			</td>
			<td class="tdContent">
				<span id="days"></span>
			</td>
		</tr>
	</tbody>
	</table>
	
    <table class="table table-bordered changeShip" id="TableShip" style="text-align: center;">
   	<thead>
	   	<tr>
			<th style="text-align: center; background-color: #eee;">船舶识别号</th>
			<th style="text-align: center; background-color: #eee;">中文船舶名称</th>
	    </tr>
    </thead>
	<tbody>

	</tbody>
	</table>
</body>
</html>